﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CC.MVC.Models
{
    /// <summary>
    /// A square is a specific type of object that has two demensions to calculate the area,
    /// therefore, we should expose the constructor that takes two parameters.
    /// </summary>
    public class Square : Shape
    {
        public Square(double x, double y) : base(x, y) { }
        public override double GetArea()
        {
            //The area of the square is calculated by multiplying the length time the width,
            //represented by X and Y in this example.

            return this.X * this.Y.Value;

            // The Y property above has a .Value property because it is nullable.The ? after the type makes it nullable.
            // Nullable<double> is a longer way to write the same thing. The ? is just shorter.
            // This means that it is a value type that is getting wrapped so that we can set the 
            // value to null.  Normally a value type will always have a default value.  For example,
            // an int has a default value of 0 and a bool has a default value of false.  int? has a default
            // value of null and we can distinguish that there is no value at all, instead of 0, which is
            // technically a value.  Z in this example has a value of null at this time because we don't need it
            // and it is a nullable double (double?).  

            // See the lesson on value vs reference types for more information.
        }
    }
}
